[RTL8722CSM] [RTL8722DM] RTC -時間顯示
材料準備
Ameba x 1
範例說明
RTC 模組會幫助微控制器來追蹤時間,是時間模組必須的一部分。我們在這裏有一個示例,來展示如何來得到本地時間和上傳時間。
複製下面的代碼貼至REPL,觀察結果。
1rtc = RTC()
2rtc.datetime() # get date and time
3rtc.datetime((2020, 12, 31, 4, 23, 58, 59, 0)) # set a specific date and time (year, month, day, weekday(0 for Monday), hour, minute, second, total seconds)
4rtc.datetime() # check the updated date and time